export enum TaskStatus {
    Pending = 'pending',
    InProgress = 'in-progress',
    Done = 'done',
    Cancelled = 'cancelled'
}

export enum TaskTag {
    ImportantUrgent = 'important-urgent',
    ImportantNotUrgent = 'important-not-urgent',
    NotImportantUrgent = 'not-important-urgent',
    NotImportantNotUrgent = 'not-important-not-urgent'
}

export interface Task {
    id: string;
    title: string;
    status: TaskStatus;
    tag?: TaskTag;
    groupId?: string;
    createdAt: number;
    updatedAt: number;
    order: number;
}

export interface TaskGroup {
    id: string;
    name: string;
    tasks: Task[];
    createdAt: number;
    updatedAt: number;
    order: number;
}

export interface TodoState {
    tasks: Task[];
    groups: TaskGroup[];
}

export const getStatusColor = (status: TaskStatus): string => {
    switch (status) {
        case TaskStatus.Pending:
            return '#CCCCCC';
        case TaskStatus.InProgress:
            return '#3498db';
        case TaskStatus.Done:
            return '#2ecc71';
        case TaskStatus.Cancelled:
            return '#e74c3c';
        default:
            return '#CCCCCC';
    }
};

export const getTagColor = (tag: TaskTag): string => {
    switch (tag) {
        case TaskTag.ImportantUrgent:
            return '#e74c3c';
        case TaskTag.ImportantNotUrgent:
            return '#f1c40f';
        case TaskTag.NotImportantUrgent:
            return '#3498db';
        case TaskTag.NotImportantNotUrgent:
            return '#95a5a6';
        default:
            return '#95a5a6';
    }
};

export const getStatusText = (status: TaskStatus): string => {
    switch (status) {
        case TaskStatus.Pending:
            return '未开始';
        case TaskStatus.InProgress:
            return '处理中';
        case TaskStatus.Done:
            return '已完成';
        case TaskStatus.Cancelled:
            return '已取消';
        default:
            return '未知状态';
    }
};

export const getTagText = (tag: TaskTag): string => {
    switch (tag) {
        case TaskTag.ImportantUrgent:
            return '重要且紧急';
        case TaskTag.ImportantNotUrgent:
            return '重要不紧急';
        case TaskTag.NotImportantUrgent:
            return '不重要但紧急';
        case TaskTag.NotImportantNotUrgent:
            return '不重要不紧急';
        default:
            return '未分类';
    }
};